package com.rt.tmpt.controller.springmvc.admin;


import com.google.gson.Gson;
import com.rt.tmpt.dto.Result;
import com.rt.tmpt.service.ILayoutUIService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * <package name="back_layoutui_ajax" namespace="/admin123/layoutUI/" extends="json-default" strict-method-invocation="false">
 * <action name="layoutUIAjax_*" class="layoutUIAction" method="{1}">
 * <result name="jsonResult" type="json">
 * <param name="root">result</param>
 * </result>
 * </action>
 * </package>
 */
@ApiIgnore
@Controller
@RequestMapping("/admin123/layoutUI")
@Slf4j
public class LayoutUIAction {

    @Resource
    ILayoutUIService layoutUIService;

    @RequestMapping(value = "/layoutUIAjax_saveStyle", produces = "application/json; charset=utf-8")
    @ResponseBody
    public String saveStyle(String keyRandom, String uiStyle, String layoutStyle, String isdialog4AddDialog,
                            HttpServletRequest request, HttpServletResponse response) {
        Result resultObj = layoutUIService.saveStyle(keyRandom, uiStyle, layoutStyle, isdialog4AddDialog);
        return new Gson().toJson(resultObj.getMap());
    }


}
